package MyStudy;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        Person[] ps = new Person[] {
            new Person("Bob", 61),
            new Person("Alice", 88),
            new Person("Lily", 75),
        };
        Arrays.sort(ps);
        System.out.println(Arrays.toString(ps));
        List list = new ArrayList();
        list.add("Hello");
        list.add("World");
        String first = (String) list.get(0);
        String second = (String) list.get(1);
    }
}
class Person implements Comparable<Person> {
   String name;
   int score;
   Person(String name, int score) {
       this.name = name;
       this.score = score;
   }
   public int compareTo(Person other) {
       return this.name.compareTo(other.name);
   }
   public String toString() {
       return this.name + "," + this.score;
   }
}
//import java.lang.reflect.InvocationHandler;
//import java.lang.reflect.Method;
//import java.lang.reflect.Proxy;
//
//import org.slf4j.LoggerFactory;
//import org.slf4j.Logger;
//
//public class Main {
//	public static void main(String[] args) {
//		Logger log=LoggerFactory.getLogger(Main.class);
//		InvocationHandler handler = new InvocationHandler() {
////			@Override
//			public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
//				System.out.println(method.getName());
//				if (method.getName().equals("morning")) {
//					System.out.println("Good morning, " + args[0]);
//				}
//				return null;
//			}
//		};
//		Hello hello = (Hello) Proxy.newProxyInstance(Hello.class.getClassLoader(), // 传入ClassLoader
//				new Class[] { Hello.class }, // 传入要实现的接口
//				handler); // 传入处理调用方法的InvocationHandler
//		log.info("汉字Mainstart");
//		hello.morning("Bob");
//		log.info("end");
//		System.out.println("汉字");
//	}
//}
//
//interface Hello {
//	void morning(String name);
//}
